;(in-package 'user)

(defvar *trace-morph*)

(setq *trace-morph* nil)

(defmacro morph-trace (&rest args)
  `(when *trace-morph* (format t ,@args)))

;; Given: code for INFLECT

(defun inflect (cat fs)
  (let ((root (second (assoc 'root fs)))
	iroot)
    (case cat
	  (n
	   (setq iroot (inflect-noun root fs))
	   (morph-trace "~%[INFLECT (~s,~s): ~s]" cat root iroot)
	   iroot)
	  (pro
	   (setq iroot (create-pronoun fs))
	   (morph-trace "~%[INFLECT (~s,~s): ~s]" cat root iroot)
	   iroot)
	  (v
	   (setq iroot (inflect-verb root fs))
	   (morph-trace "~%[INFLECT (~s,~s): ~s]" cat root iroot)
	   iroot)
	  (t (morph-trace "~%[INFLECT (~s,~s): Not defined for ~s]" cat root cat)
	     root))))

;; You must write: 
;;
;; INFLECT-NOUN   (input: root, fs; output: inflected string)
;;   -- If (NUMBER PL), add "s" to root.
;;
;; INFLECT-VERB   (input: root, fs; output: inflected string)
;;   -- If (NUMBER SG) and (PERSON 3), add "s" to root.
;;
;; CREATE-PRONOUN (input: fs; output: string)
;;   -- All combinations of features and desired outputs can
;;      be seen in <a href="test-code.lisp">test-code.lisp</a>.


